import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../components/Login.vue'
import Home from '../components/Home.vue'
import Welcome from '../components/Welcome.vue'
import Users from '../components/user/Users.vue'
import test from '../components/test'
import Firstline from '../components/line/Firstline'

Vue.use(VueRouter)

const routes = [
  // 重定向，当访问根路径的时候，自动跳转到登录组件的路径
  { path: '/', redirect: '/login' },
  { path: '/login', component: Login},
  { path: '/test', component: test },

  {
    path: '/home', component: Home,
    redirect: '/welcome',
    // 子路由
    children: [
      { path: '/welcome', component: Welcome },
      { path: '/users', component: Users },
      { path: '/firstline', component: Firstline },

    ]
  },
]

const router = new VueRouter({
  routes
})


export default router

